package co.edu.unal.geditor.view.tools;

import java.awt.Color;
import java.awt.Point;

import co.edu.unal.geditor.controller.action.tool.EllipseToolAction;
import co.edu.unal.geditor.model.EllipseElement;
import co.edu.unal.geditor.model.GraphElement;

public class EllipseCreationTool extends CreationTool
{
	// v0.6 : EllipseCreationTool provides its own Factory class 
	private static class Factory extends ToolFactory
	{
		protected Tool create()
		{
			return new EllipseCreationTool();
		}
	}

	// this block executed when the class object is loaded in the VM
	// registers its Factory
	static
	{
		ToolFactory.register( EllipseCreationTool.class.getName(), new Factory() );
	}

	@Override
	public GraphElement createObject( Point ptPressed, Point ptReleased )
	{
		return new EllipseElement( ptPressed, ptReleased );
	}

	@Override
	protected void initAction()
	{
		setAction( new EllipseToolAction() );
		if(feedbackGraphElemet==null)
			{
			feedbackGraphElemet = new EllipseElement(new Point(0,0), new Point(20,20), Color.LIGHT_GRAY);
			}
	}
}
